/* go.cpp */

/* by Collin McMillan <cmc@nd.edu> */
/* demonstration of how to integrate using cmake */

#include "keyboard_input/KeyboardHandler.h"
#include "situationControl/SituationController.h"
#include "glOutput/Graphics.h"
#include "networkIO/networkHandler.h"
#include <boost/thread/thread.hpp>


int main(int argc, char *argv[])
{
	SituationController *mSC = new SituationController();
	KeyboardHandler *mKH = new KeyboardHandler(7, mSC);

	Graphics *glWindow = new Graphics();
	glWindow->acceptKeyboardHandler(mKH);
	glWindow->initScene(argc, argv);

	mSC->acceptGraphics(glWindow);
	//SituationController mSituationController;

	networkI::networkHandler *myH = new networkI::networkHandler();
	mSC->setNetwork(myH);
	boost::thread t(boost::bind(&boost::asio::io_service::run, myH->getIOservice()));
	fprintf(stderr, "done\n");

	//Situation mSituation;
	while (1) {
		mSC->tick();
		usleep(250); //sleep for 250 ms
		//glWindow.draw(mSituation);
	}
	return 0;
}

